Skip to content

Add doc for impl From for Error #53517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 8, 2018
Merged

Add doc for impl From for Error #53517

merged 4 commits into from
Oct 8, 2018

Conversation

phungleson
Copy link
Contributor

As part of issue #51430 (cc @skade).

The impl is very simple, let me know if we need to go into any details.

@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 20, 2018
@dtolnay
Copy link
Member

dtolnay commented Aug 20, 2018

@bors delegate=skade

@bors
Copy link
Collaborator

bors commented Aug 20, 2018

✌️ @skade can now approve this pull request

@pietroalbini
Copy link
Member

Ping from triage @skade! This PR needs your review.

@TimNN
Copy link
Contributor

TimNN commented Sep 4, 2018

Ping from triage @skade / @rust-lang/docs: This PR requires your review.

@@ -212,6 +212,12 @@ impl ErrorKind {
/// the heap (for normal construction via Error::new) is too costly.
#[stable(feature = "io_error_from_errorkind", since = "1.14.0")]
impl From<ErrorKind> for Error {
/// Converts a [`ErrorKind`] into a [`Error`].
///
/// This conversion allocates a new error with simple repr.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repr? (please write the full word).

@GuillaumeGomez
Copy link
Member

Please add an example.

@phungleson
Copy link
Contributor Author

Hey, I am currently traveling, will look at this again in around 3 weeks.

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2018
@TimNN TimNN added A-allocators Area: Custom and system allocators and removed A-allocators Area: Custom and system allocators labels Sep 11, 2018
@TimNN TimNN added A-allocators Area: Custom and system allocators and removed A-allocators Area: Custom and system allocators labels Sep 25, 2018
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:04:40] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:41] tidy error: /checkout/src/libstd/io/error.rs:223: trailing whitespace
[00:04:42] some tidy checks failed
[00:04:42] 
[00:04:42] 
[00:04:42] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:42] 
[00:04:42] 
[00:04:42] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:42] Build completed unsuccessfully in 0:00:55
[00:04:42] Build completed unsuccessfully in 0:00:55
[00:04:42] make: *** [tidy] Error 1
[00:04:42] Makefile:79: recipe for target 'tidy' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00ac71e1
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:05677c85:start=1537940447065740989,finish=1537940447070032233,duration=4291244
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:05006e2c
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0144f2d0
travis_time:start:0144f2d0
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:13ae7763
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@phungleson
Copy link
Contributor Author

@GuillaumeGomez an example was added

@GuillaumeGomez
Copy link
Member

Please remove fn main() here and just keep its code.

@frewsxcv
Copy link
Member

To expand on @GuillaumeGomez 's comment, you don't need to add the main function in documentation examples. See also:

https://doc.rust-lang.org/book/first-edition/documentation.html#documentation-as-tests

@phungleson
Copy link
Contributor Author

Cool thanks @frewsxcv @GuillaumeGomez main has been removed

@@ -212,6 +212,19 @@ impl ErrorKind {
/// the heap (for normal construction via Error::new) is too costly.
#[stable(feature = "io_error_from_errorkind", since = "1.14.0")]
impl From<ErrorKind> for Error {
/// Converts a [`ErrorKind`] into a [`Error`].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thought: shouldn't it be "an Error"?

@frewsxcv
Copy link
Member

frewsxcv commented Oct 6, 2018

@phungleson Hope you don't mind I pushed a small grammar change. Thanks for the docs contribution!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Oct 6, 2018

📌 Commit 4f3896d has been approved by frewsxcv

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 6, 2018
@phungleson
Copy link
Contributor Author

@frewsxcv not at all thanks!

@bors
Copy link
Collaborator

bors commented Oct 7, 2018

⌛ Testing commit 4f3896d with merge b9adc33...

bors added a commit that referenced this pull request Oct 7, 2018
Add doc for impl From for Error

As part of issue #51430 (cc @skade).

The impl is very simple, let me know if we need to go into any details.
@bors
Copy link
Collaborator

bors commented Oct 8, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: frewsxcv
Pushing b9adc33 to master...

@bors bors merged commit 4f3896d into rust-lang:master Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants